package code.rocky.chapter02.item2;


public class NutritionFacts {

    // Parameters initialized to default values (if any)
    private int servingSize  = -1; // Required; no default value
    private int servings     = -1; // Required; no default value
    private int calories     = 0;
    private int calorie         ;
    private boolean flag        ;
    private int fat          = 0;
    private int sodium       = 0;
    private int carbohydrate = 0;

    public NutritionFacts() {
    }

    public int getCalorie() {
        return calorie;
    }

    public boolean isFlag() {
        return flag;
    }

    // setter
    public void setServingSize(int servingSize) {
        this.servingSize = servingSize;
    }

    public void setServings(int servings) {
        this.servings = servings;
    }

    public void setCalories(int calories) {
        this.calories = calories;
    }

    public void setFat(int fat) {
        this.fat = fat;
    }

    public void setSodium(int sodium) {
        this.sodium = sodium;
    }

    public void setCarbohydrate(int carbohydrate) {
        this.carbohydrate = carbohydrate;
    }

    public static void main(String[] args) {
        NutritionFacts cocaCola = new NutritionFacts();
        cocaCola.setCalories(100);
        cocaCola.setServings(80);
        cocaCola.setFat(110);
        cocaCola.setSodium(90);
        cocaCola.setServingSize(120);
        System.out.println("type int initialized default value is:     " + cocaCola.getCalorie()); // initialized default value is 0
        System.out.println("type boolean initialized default value is: " + cocaCola.isFlag());
    }
}
